<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数组静态方法</title>
    <script>
        //from若为单一字符串，拆分为一个个字母的数组；
        //若为from（数组，函数）则将数组一个个放入函数运算，返回每个值的运算结果组成的数组
        console.log(Array.from('foo'));
        console.log(Array.from([1, 2, 3], (x) => x + x));

        //isArray判断是否为数组，字符串为false，正常数组为true
        console.log(Array.isArray([1, 3, 5]));
        console.log(Array.isArray('[]'));
        console.log(Array.isArray([]));
        console.log(Array.isArray(new Array(5)));
        console.log(Array.isArray(new Int16Array([15, 33])));

        //of直接创建新数组
        console.log(Array.of('foo', 2, 'bar', true));
        console.log(Array.of());
    </script>
</head>

<body>

</body>

</html>